package com.bsj.travel.system;

import com.bsj.travel.constant.SecurityConstants;
import com.bsj.travel.constant.ServiceNameConstants;
import com.bsj.travel.def.global.JsonResult;
import com.bsj.travel.system.factory.RemoteUserFallbackFactory;
import com.bsj.travel.def.common.VO.TokenUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @author yinhao
 * @version 1.0
 * @description 用户服务
 * @date 2023/11/2
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {

    /**
     * 通过用户名称查询用户信息
     * @param userName 用户名
     * @param source 请求来源
     * @return
     */
    @GetMapping(value = "/user/info/{userName}")
    JsonResult<TokenUser> queryUserByName(@PathVariable("userName") String userName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
